package com.common.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.common.entity.PageDO;
import com.common.entity.SysLogDO;
import com.common.mapper.LogMapper;
import com.common.service.LogService;
import com.common.utils.Query;

@Service
public class LogServiceImpl implements LogService {
  @Autowired
  LogMapper logMapper;

  @Override
  public PageDO<SysLogDO> queryList(Query query) {
    List<SysLogDO> logs = logMapper.list(query);
    int total = logMapper.count();
    PageDO<SysLogDO> page = new PageDO<>();
    page.setTotal(total);
    page.setRows(logs);
    return page;
  }

  @Override
  public int remove(Long id) {
    int count = logMapper.remove(id);
    return count;
  }

  @Override
  public int batchRemove(List<Long> ids) {
    int count = logMapper.batchRemove(ids);
    return count;
  }
}
